﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace WebAppTemplate.CSR.Repository.Entities
{
    public class DemoOneWithOne
    {
        public long Id { get; set; }
        public string? Value { get; set; }
        public Demo? Demo { get; set; }
    }

    public class DemoOneWithOneConfig : IEntityTypeConfiguration<DemoOneWithOne>
    {
        public void Configure(EntityTypeBuilder<DemoOneWithOne> builder)
        {
            builder.HasKey(it => it.Id);
            builder.Property(it => it.Id).ValueGeneratedNever();

            builder.HasOne(it => it.Demo).WithOne(it => it.OneWithOne);
        }
    }
}
